package com.chenggcode.simple.aop.aspects;

import com.chenggcode.simple.aop.annotations.Annotation1;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.stereotype.Component;

/**
 * @author Chenggcode
 * @date 2025/6/18 17:30
 */
@Aspect
@Component
public class Annotation1Aspect {

    @Around(value = "@annotation(annotation1)")
    public Object aroundAnnotation1(ProceedingJoinPoint joinPoint, Annotation1 annotation1) throws Throwable {
        System.out.println("[Annotation1]Before method: " + joinPoint.getSignature().getName());
        Object result = joinPoint.proceed(); // 执行被注解的方法
        System.out.println("[Annotation1]After method: " + joinPoint.getSignature().getName());
        return result;
    }

}
